<?php

use common\components\helpers\Fun;
use common\components\extenders\MenuManage;

?>
<div class="yx-praise-list-box yx-praise-box yx-radius2 zx-min-height">
    <div class="docs-main zx-mg">
        <table id="tablesaw" class="tablesaw table yx-table1 yx-table3 table-striped with-check">
            <thead>
            <tr class="yx-bgd2f6ec">
                <td>课程名称</td>
                <td>上课日期</td>
                <td>上课时间</td>
                <td>课次</td>
                <td>状态</td>
                <td>备注</td>
                <td>操作</td>
            </tr>
            </thead>
            <?php foreach ($details as $i => $v) { ?>
                <tr>
                    <td><?= \yii\helpers\Html::encode($v->title) ?></td>
                    <td><?= \Yii::$app->formatter->asDate($v->class_date) ?></td>
                    <td><?= \common\components\helpers\Fun::getClassTime($v->start_time, $v->end_time) ?></td>
                    <td><?= \yii\helpers\Html::encode($v->lesson) ?></td>
                    <td><?php if ($v->status == 0) {
                            echo '未上课';
                        } elseif ($v->status == 1) {
                            echo '已上课';
                        } elseif ($v->status == 5) {
                            echo '教师请假';
                        } elseif ($v->status == 6) {
                            echo '停课';
                        } else {
                            echo '已调课';
                        } ?></td>
                    <td><?= \yii\helpers\Html::encode($v->remark) ?></td>
                    <td>
                        <?php if ($v->status == 0): ?>
                            <?= (new MenuManage(MenuManage::TOP_MENU))->detailsMenu('newclassmanage', 'status', false, ['rel' => 'dialog-show-iframe', 'class' => 'btn yx-radius2 yx-d-card yx-bg94d5a2', 'id' => "lesson$i", 'data' => ['lesson_id' => $v->lesson_id, 'name' => '设置']]); ?>
                        <?php else: ?>
                            <button class="yx-btn-disabled" type="button">设置</button>
                        <?php endif; ?>
                        <?php if ($v->status == 0 && time() < $v->class_date): ?>
                            <?= (new MenuManage(MenuManage::TOP_MENU))->detailsMenu('newclassmanage', 'updateclasstime', false, ['rel' => 'dialog-show-iframe', 'class' => 'btn yx-radius2 yx-d-card yx-bg94d5a2', 'data' => ['id' => $v->lesson_id, 'name' => '修改日期']]); ?>
                        <?php endif; ?>
                        <?php if ($v->status == 0 && time() < $v->class_date): ?>
                            <?= (new MenuManage(MenuManage::TOP_MENU))->detailsMenu('newclassmanage', 'relesson', false, ['rel' => 'record_item_confirm', 'class' => 'btn yx-radius2 yx-d-card yx-bgb5b5b5', 'data' => ['id' => $v->lesson_id, 'message' => '确定要移除第' . $v->lesson . '节么？']]); ?>
                        <?php endif; ?>
                    </td>
                </tr>
            <?php } ?>
        </table>
    </div>
</div>